<?php

/**
 *
 * @license   https://www.rongyun.cc
 * @link      https://www.rongyun.cc
 * @author    wangyadong<wangyadong280@gmail.com>
 * @date      2017-04-13 10:07
 */
namespace App\Models;

use Auth;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject as AuthenticatableUserContract;


class Users extends Authenticatable implements AuthenticatableUserContract
{

    protected $table = 'users';

    protected $primaryKey = 'id';
    // 查询用户的时候，不暴露密码
    protected $hidden = ['password'];

    /**
     * @return mixed
     */
    public function getJWTIdentifier()
    {
        return $this->getKey(); // Eloquent model method
    }

    /**
     * @return array
     */
    public function getJWTCustomClaims()
    {
        return [];
    }

    public function categories()
    {
        return $this->hasMany('App\Models\Category', 'user_id');
    }

    public function bookmarks()
    {
        return $this->hasMany('App\Models\Bookmark', 'user_id');
    }
}